package com.springboot.springbootredis.web;

import com.springboot.springbootredis.mq.stream.MessagePublisher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("stream")
@RestController
public class RedisStreamController {


    @Autowired
    private MessagePublisher messagePublisher;

    @GetMapping("{topic}/{key}/{value}")
    public String send(@PathVariable String topic, @PathVariable String key, @PathVariable String value){

        messagePublisher.sendMessage(topic, key, value);

        return "SUCCESS";
    }

}
